{include file='header.tpl'}
<div id="article">
<h2>{$article->subject}</h2>
<p>作者：<a href="{geturl route='space' 
    username=$user->username action='index'}">{$user->username}</a> 
    | 发表时间：{$article->dateline|date_format:'%Y-%m-%d %H:%M'}</p>
<p>{$article->content}</p>
</div>
<div id="remarks">
{if $totalRemarks == 0}
    <p>暂时还没有评论</p>
{else}
        {foreach from=$remarks item=remark}
            <div>
                <h3>{$remark->dateline|date_format:'%Y-%m-%d %H:%M'}|
                <a href="{geturl route='space' 
                    username=$remark->username action='index'}">{$remark->username}</a> 说：</h3>
                <p>
                    {$remark->content}
                </p>
                    
            </div>
        {/foreach}
{/if}
</div>

<div id="remarkto">
{if $authenticated}
    <form method="post" action="{geturl action='view'}?id={$article->getId()}">
    {if $fp->hasError()}
        <div class="error">
                                发生错误，请检查后再次提交。
        </div>
        {include file='lib/error.tpl' error=$fp->getError('title')}
    {/if}
    <div>
        <label for="form_content">内容</label>
        <span>{wysiwyg name='content' value=$fp->content}</span>
        {include file='lib/error.tpl' error=$fp->getError('content')}
    </div>
    <div>
        <input class="submit" type="submit" name="remark" value="发表" />
    </div>
    </form>

{else}
    <p><a href="{geturl action='login' controller='account'}">登录</a>
        <a href="{geturl action='register' controller='account'}">注册</a>后发表评论。</p>
{/if}
</div>
{include file='footer.tpl'}